var demo = angular.module("demo", ["RongWebIMWidget"]);

demo.controller("main", ["$scope", "$http", "RongCustomerService", function($scope, $http, RongCustomerService) {
    $scope.targetType = 1; //1：私聊 更多会话类型查看http://www.rongcloud.cn/docs/api/js/global.html#ConversationType
    $scope.targetId = '47';

    $scope.setconversation = function() {
        WebIMWidget.setConversation($scope.targetType, $scope.targetId, "" + $scope.targetId);
    }
    RongCustomerService.init({
        appkey: "cpj2xarlc1e2n",
        token: "DYmHzE7Lp11jwymoHHMeT2ze1+jK7TSILlpgAn6GSjtmNJmJH4pMeZHkJ0tW/gbyP+FV0eKwbMk=",
        customerServiceId: "zgX1JCkl3Ctt",
        position: RongCustomerService.Position.right,
        style: {
            width: 320
        },
        onSuccess: function(e) {
            console.log('连接成功');
        },
        onError: function(e) {
            console.log('连接失败');
        }
    });
    $scope.show = function() {
        RongCustomerService.show();
    };
    $scope.hidden = function() {
        RongCustomerService.hidden();
    };
}]);